from stock_control.control import ControlPurchaseStock
from stock_control.init_strategy import init_strategy_obj_and_fund
from datetime import datetime
from stock_control.emailSender import EmailSender


if __name__ == '__main__':
    # 第一次打开股票交易系统
    # 输入总资金和策略总数
    money = input("输入交易总资金：")
    num = input("输入策略总数：")
    # 发送邮件
    es = EmailSender()
    today = datetime.now().strftime("%Y-%m-%d")
    es.send_system_condition(today, 'open')
    # 将所有策略对象写进策略数组,并且初始化资金
    strategy = []
    init_strategy_obj_and_fund(strategy, money, num)
    # 建立一个控制股票交易类的对象
    control_purchase = ControlPurchaseStock(strategy)
    # 先运行一次计划购买函数
    control_purchase.make_plan()
    # 按照股票买卖控制函数，继续控制每日股票的计划制定和买卖
    control_purchase.control_transaction()
    '''
    # 建立一个控制查看股票交易信息的对象
    control_display = ControlDisplayInfo(strategy)
    # 按照股票信息查看控制函数，控制查看活动
    control_display.control_display()
    '''
